<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j">

	<rich:panel id="Edit" styleClass="form">
		


			<a4j:form ajaxSingle="true">
				<h:panelGrid>
					<div class="attributes">
						<s:decorate template="/layout/input.xhtml">
							<ui:define name="label">Codigo</ui:define>
							<h:inputText id="PersonCode" maxlength="20"
								value="#{editPerson.editPerson.cod}"
								required="true" size="5"
								requiredMessage="Favor introduzca un codigo"
								validatorMessage="El codigo no puede ser menor a 3 o mayor a 5">
								<f:validateLength minimum="3" maximum="5" />
								<a4j:support event="onblur" />
							</h:inputText>
							<div class="msg_container">
								<rich:message for="PersonCode" />
							</div>
						</s:decorate>
						<div style="clear: both;" />

						<s:decorate template="/layout/input.xhtml">
							<ui:define name="label">Nombre</ui:define>
							<h:inputText id="PersonName" maxlength="100"
								value="#{editPerson.editPerson.name}"
								required="true" size="50"
								requiredMessage="Favor introduzca el nombre de la persona"
								validatorMessage="El nombre no puede ser menor a 3 o mayor a 100">
								<f:validateLength minimum="3" maximum="100" />
								<a4j:support event="onblur" />
								
							</h:inputText>
							<div class="msg_container">
								<rich:message for="PersonName" />
							</div>
						</s:decorate>

						<div style="clear: both;" />
						<s:decorate template="/layout/input.xhtml">
							<ui:define name="label">Nombre Fantasia</ui:define>
							<h:inputText id="PersonFantasyName" maxlength="100"
								value="#{editPerson.editPerson.nameFant}"
								required="false" size="50"
								validatorMessage="El nombre de fantasia no puede ser menor a 3 o mayor a 100">
								<f:validateLength minimum="3" maximum="100" />
								<a4j:support event="onblur" />
							</h:inputText>
							<div class="msg_container">
								<rich:message for="PersonFantasyName" />
							</div>
						</s:decorate>

						<div style="clear: both;" />
						<s:decorate template="/layout/input.xhtml">
							<ui:define name="label">R.U.C.</ui:define>
							<h:inputText id="PersonRUC" maxlength="16"
								value="#{editPerson.editPerson.ruc}"
								required="true" size="16"
								requiredMessage="Favor introduzca el RUC de la persona"
								validatorMessage="El RUC debe tener 16 caracteres">
								<f:validateLength minimum="7" maximum="16" />
								<a4j:support event="onblur" />
							</h:inputText>
							<div class="msg_container">
								<rich:message for="PersonRUC" />
							</div>
						</s:decorate>


						<div style="clear: both" />
						<s:decorate template="/layout/input.xhtml">
							<ui:define name="label">Persona Juridica</ui:define>
							<h:selectBooleanCheckbox id="PersonIsJuridic"
								value="#{editPerson.editPerson.isJur}">
								<a4j:support event="onblur" />
								<a4j:support event="onclick" ajaxSingle="true">
									<s:conversationId />
								</a4j:support>
							</h:selectBooleanCheckbox>
							<div class="msg_container">
								<rich:message for="PersonIsJuridic" />
							</div>
						</s:decorate>
						
						<div style="clear: both" />
						<s:decorate template="/layout/input.xhtml">
							<ui:define name="label">Sexo</ui:define>
							<h:selectOneRadio value="#{editPerson.editPerson.sex}" id="PersonSex">
								<f:selectItem itemLabel="Masculino" itemValue="M" />
								<f:selectItem itemLabel="Femenino" itemValue="F" />
								<a4j:support event="onblur" />
							</h:selectOneRadio>
							<div class="msg_container">
								<rich:message for="PersonSex" />
							</div>
						</s:decorate>
						<div style="clear: both" />
						<s:decorate template="/layout/input.xhtml">
							<ui:define name="label">Sector Economico</ui:define>
							<rich:comboBox value="#{editPerson.editPerson.sectorData}" 
								id="Sector"
								converter="#{refConverter}"
								converterMessage="Favor seleccione el sector"
								defaultLabel="Sector"
								enableManualInput="true"
								required="true"
								requiredMessage="Favor seleccione el sector"
								>
								<a4j:support event="onselect" />
															
									<s:selectItems  value="#{withinHolder.refDetListByHeadCod(editPerson.sectorEco)}" var="ref" label="#{ref.descrip}">
									</s:selectItems>
									
							</rich:comboBox>
							<div class="msg_container">
								<rich:message for="Sector" />
							</div>
						</s:decorate>

						<div style="clear: both" />
						<s:decorate template="/layout/input.xhtml">
							<ui:define name="label">Activo</ui:define>
							<h:selectBooleanCheckbox id="PersonIsActive"
								value="#{editPerson.editPerson.status}">
								<a4j:support event="onblur" />
								<a4j:support event="onclick" ajaxSingle="true">
									<s:conversationId />
								</a4j:support>
							</h:selectBooleanCheckbox>
							<div class="msg_container">
								<rich:message for="PersonIsActive" />
							</div>
						</s:decorate>
					</div>

					
						
		
				<s:decorate template="/layout/displayButton.xhtml">
					<a4j:commandButton value="Guardar"
						action="#{editPerson.personUpd()}"
						oncomplete="#{rich:component('PersonModalPanel')}.hide()"
						reRender="updPersonGridForm, updPersonForm" />
					<rich:spacer width="20px" />
					<a4j:commandButton value="Cancelar"
						oncomplete="#{rich:component('PersonModalPanel')}.hide()"
						action="#{editPerson.changeUpdTab('updPerson')}" >
					</a4j:commandButton>
				</s:decorate>
			
			</h:panelGrid>
		</a4j:form>
	</rich:panel>
</ui:composition>